﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using RM2012Service.DataAccess;
using System.Data;
using RM2012Service.Business;

namespace RM2012Service.Controller
{
    public class InvoiceDetailCtrl
    {
        InvoiceDetailDAO dao;

        public InvoiceDetailCtrl()
        {
            dao = new InvoiceDetailDAO();
        }

        public DataSet GetInvoiceDetailByInvoiceId(string invoiceId)
        {
            return dao.GetInvoiceDetailByInvoiceId(invoiceId);
        }

        public DataSet GetInvoiceDetailByMenuAndInvoice(String invoiceId, String menuId)
        {
            return dao.GetByMenuAndInvoice(invoiceId, menuId);
        }

        public bool AddInvoiceDetail(InvoiceDetailInfo info)
        {
            if (dao.Add(info) > 0)
            {
                return true;
            } 
            else
            {
                return false;
            }
        }

        public bool UpdateInvoiceDetail(InvoiceDetailInfo info)
        {
            if (dao.Update(info) > 0)
            {
                return true;
            } 
            else
            {
                return false;
            }
        }

        public bool DeleteInvoiceDetail(InvoiceDetailInfo info)
        {
            if (dao.Delete(info) > 0)
            {
                return true;
            } 
            else
            {
                return false;
            }
        }
    }
}
